#include <iostream>
#include <string>
#include <typeinfo>
#include <vector>
#include <map>
#include "String.hpp"
#include "Node.hpp"
#include "Visitor.hpp"

#ifndef ELEMENT_HPP
#define ELEMENT_HPP
namespace xml{

using namespace std;

typedef struct st_chNM{
	String nm;
	String uri;
}st_chNM;

class Visitor;
//class Element ;


class Element : public Node {
	public:
		// Returns the name of the element.  This is just
		// the part after the colon.  If there is no colon, then
		// it is the whole thing, of course.
		const String &name() const;
		// Returns the full namespace URI (not the prefix) of the element.
		// If the element is not in any namespace, this should simply
		// return an empty String.  Note that 'namespace' is a reserved
		// keyword, so we don't fully spell it out.
		const String &nmspace() const;
		const String &nm_id() const;
		// Returns the number of children nodes.
		size_t n_children() const;
		// Returns the i'th child.
		const Node *child(size_t i) const;
		// Accepts a visitor.
		void accept(Visitor *) const;
		// Convenience functions that internally will use RTTI.
		static bool is_Element(const Node *);
		static const Element *to_Element(const Node *);
		
		Element();
		~Element();
		void addName (const String nm);
		void addChildNMSpace (const String nm, const String qt);
		void addNMSpace (const String nms);
		void addNode (Node *nd);
		int nm_child();
		void remove();
		// You could add more to the public interface, if you wanted to.

		void* operator new (size_t size); 
		void operator delete (void *p); 

		static int count;

		// TODO : Use linked-list instead of vector
	private:
		// Private things for your implementation.
		String ele_name;
		String ele_nm_id;
		String ele_namespace;
		vector<st_chNM > child_nmspace;	
		vector<Node* > ele_nodes;
		int children;
		
};

typedef struct t_mem_pool{
	int isfree;
	Element base;
}mem_pool;


}
#endif
